﻿using System;
using System.Data;
using System.Text;
using System.Data.SqlClient;
using Common;

namespace DAL
{
    public class MedicalResultDataFactory
    {
        public static MedicalResultData Construct(IDataReader reader)
        {
            MedicalResultData data = new MedicalResultData();

            try { data.ID = Convert.ToString(reader["ID"]); }
            catch { }

            try { data.TEID = Convert.ToString(reader["TEID"]); }
            catch { }

            try { data.TemporaryUserID = Convert.ToString(reader["TemporaryUserID"]); }
            catch { }

            try { data.fujianqingdan = Convert.ToInt32(reader["fujianqingdan"]); }
            catch { }

            try { data.Time = Convert.ToDateTime(reader["Time"]); }
            catch { }

            try { data.ShenGao = Convert.ToDouble(reader["ShenGao"]); }
            catch { }

            try { data.TiZhong = Convert.ToDouble(reader["TiZhong"]); }
            catch { }

            try { data.ErWen = Convert.ToDouble(reader["ErWen"]); }
            catch { }

            try { data.GaoYa = Convert.ToInt32(reader["GaoYa"]); }
            catch { }

            try { data.DiYa = Convert.ToInt32(reader["DiYa"]); }
            catch { }

            try { data.XinLv = Convert.ToInt32(reader["XinLv"]); }
            catch { }

            try { data.XindianDatas = Convert.ToString(reader["XindianDatas"]); }
            catch { }

            try { data.XinDianResult = Convert.ToInt32(reader["XinDianResult"]); }
            catch { }

            try { data.XinDianXinLv = Convert.ToInt32(reader["XinDianXinLv"]); }
            catch { }

            try { data.SpO2 = Convert.ToInt32(reader["SpO2"]); }
            catch { }

            try { data.PR = Convert.ToInt32(reader["PR"]); }
            catch { }

            try { data.PI = Convert.ToInt32(reader["PI"]); }
            catch { }

            try { data.XueTang1 = Convert.ToDouble(reader["XueTang1"]); }
            catch { }

            try { data.XueTang2 = Convert.ToDouble(reader["XueTang2"]); }
            catch { }

            try { data.NiaoSuan = Convert.ToDouble(reader["NiaoSuan"]); }
            catch { }

            try { data.DanGuChun = Convert.ToDouble(reader["DanGuChun"]); }
            catch { }

            try { data.ZhiFang = Convert.ToDouble(reader["ZhiFang"]); }
            catch { }

            try { data.BMI = Convert.ToDouble(reader["BMI"]); }
            catch { }

            try { data.XinChenDaiXie = Convert.ToInt32(reader["XinChenDaiXie"]); }
            catch { }

            try { data.TiZhi = Convert.ToInt32(reader["TiZhi"]); }
            catch { }

            try { data.TiXing = Convert.ToInt32(reader["TiXing"]); }
            catch { }

            try { data.YaoWei = Convert.ToDouble(reader["YaoWei"]); }
            catch { }

            try { data.TunWei = Convert.ToDouble(reader["TunWei"]); }
            catch { }

            try { data.Bak20 = Convert.ToString(reader["Bak20"]); }
            catch { }

            try { data.Bak19 = Convert.ToString(reader["Bak19"]); }
            catch { }

            try { data.Bak18 = Convert.ToString(reader["Bak18"]); }
            catch { }

            try { data.Bak17 = Convert.ToString(reader["Bak17"]); }
            catch { }

            try { data.Bak16 = Convert.ToString(reader["Bak16"]); }
            catch { }

            try { data.Bak15 = Convert.ToString(reader["Bak15"]); }
            catch { }

            try { data.Bak14 = Convert.ToString(reader["Bak14"]); }
            catch { }

            try { data.Bak13 = Convert.ToString(reader["Bak13"]); }
            catch { }

            try { data.Bak12 = Convert.ToString(reader["Bak12"]); }
            catch { }

            try { data.Bak11 = Convert.ToString(reader["Bak11"]); }
            catch { }

            try { data.Bak10 = Convert.ToString(reader["Bak10"]); }
            catch { }

            try { data.Bak9 = Convert.ToString(reader["Bak9"]); }
            catch { }

            try { data.Bak8 = Convert.ToString(reader["Bak8"]); }
            catch { }

            try { data.Bak7 = Convert.ToString(reader["Bak7"]); }
            catch { }

            try { data.Bak6 = Convert.ToString(reader["Bak6"]); }
            catch { }

            try { data.Bak5 = Convert.ToString(reader["Bak5"]); }
            catch { }

            try { data.Bak4 = Convert.ToString(reader["Bak4"]); }
            catch { }

            try { data.Bak3 = Convert.ToString(reader["Bak3"]); }
            catch { }

            try { data.Bak2 = Convert.ToString(reader["Bak2"]); }
            catch { }

            try { data.Bak1 = Convert.ToString(reader["Bak1"]); }
            catch { }

            try { data.Bak29 = Convert.ToString(reader["Bak29"]); }
            catch { }

            try { data.Bak28 = Convert.ToString(reader["Bak28"]); }
            catch { }

            try { data.Bak27 = Convert.ToString(reader["Bak27"]); }
            catch { }

            try { data.Bak26 = Convert.ToString(reader["Bak26"]); }
            catch { }

            try { data.Bak25 = Convert.ToString(reader["Bak25"]); }
            catch { }

            try { data.Bak24 = Convert.ToString(reader["Bak24"]); }
            catch { }

            try { data.Bak23 = Convert.ToString(reader["Bak23"]); }
            catch { }

            try { data.Bak22 = Convert.ToString(reader["Bak22"]); }
            catch { }

            try { data.Bak21 = Convert.ToString(reader["Bak21"]); }
            catch { }

            try { data.Bak30 = Convert.ToString(reader["Bak30"]); }
            catch { }

            return data;
        }
        public static MedicalResultData Construct(DataTable dt)
        {
            return Construct(dt, 0);
        }
        public static MedicalResultData Construct(DataTable dt, int rowIndex)
        {
            MedicalResultData data = new MedicalResultData();

            if (dt.Rows.Count < rowIndex + 1)

                return null;

            DataRow dr = dt.Rows[rowIndex];

            if (dr == null)

                return null;

            try { data.ID = Convert.ToString(dr["ID"]); }
            catch { }

            try { data.TEID = Convert.ToString(dr["TEID"]); }
            catch { }

            try { data.TemporaryUserID = Convert.ToString(dr["TemporaryUserID"]); }
            catch { }

            try { data.fujianqingdan = Convert.ToInt32(dr["fujianqingdan"]); }
            catch { }

            try { data.Time = Convert.ToDateTime(dr["Time"]); }
            catch { }

            try { data.ShenGao = Convert.ToDouble(dr["ShenGao"]); }
            catch { }

            try { data.TiZhong = Convert.ToDouble(dr["TiZhong"]); }
            catch { }

            try { data.ErWen = Convert.ToDouble(dr["ErWen"]); }
            catch { }

            try { data.GaoYa = Convert.ToInt32(dr["GaoYa"]); }
            catch { }

            try { data.DiYa = Convert.ToInt32(dr["DiYa"]); }
            catch { }

            try { data.XinLv = Convert.ToInt32(dr["XinLv"]); }
            catch { }

            try { data.XindianDatas = Convert.ToString(dr["XindianDatas"]); }
            catch { }

            try { data.XinDianResult = Convert.ToInt32(dr["XinDianResult"]); }
            catch { }

            try { data.XinDianXinLv = Convert.ToInt32(dr["XinDianXinLv"]); }
            catch { }

            try { data.SpO2 = Convert.ToInt32(dr["SpO2"]); }
            catch { }

            try { data.PR = Convert.ToInt32(dr["PR"]); }
            catch { }

            try { data.PI = Convert.ToInt32(dr["PI"]); }
            catch { }

            try { data.XueTang1 = Convert.ToDouble(dr["XueTang1"]); }
            catch { }

            try { data.XueTang2 = Convert.ToDouble(dr["XueTang2"]); }
            catch { }

            try { data.NiaoSuan = Convert.ToDouble(dr["NiaoSuan"]); }
            catch { }

            try { data.DanGuChun = Convert.ToDouble(dr["DanGuChun"]); }
            catch { }

            try { data.ZhiFang = Convert.ToDouble(dr["ZhiFang"]); }
            catch { }

            try { data.BMI = Convert.ToDouble(dr["BMI"]); }
            catch { }

            try { data.XinChenDaiXie = Convert.ToInt32(dr["XinChenDaiXie"]); }
            catch { }

            try { data.TiZhi = Convert.ToInt32(dr["TiZhi"]); }
            catch { }

            try { data.TiXing = Convert.ToInt32(dr["TiXing"]); }
            catch { }

            try { data.YaoWei = Convert.ToDouble(dr["YaoWei"]); }
            catch { }

            try { data.TunWei = Convert.ToDouble(dr["TunWei"]); }
            catch { }

            try { data.Bak20 = Convert.ToString(dr["Bak20"]); }
            catch { }

            try { data.Bak19 = Convert.ToString(dr["Bak19"]); }
            catch { }

            try { data.Bak18 = Convert.ToString(dr["Bak18"]); }
            catch { }

            try { data.Bak17 = Convert.ToString(dr["Bak17"]); }
            catch { }

            try { data.Bak16 = Convert.ToString(dr["Bak16"]); }
            catch { }

            try { data.Bak15 = Convert.ToString(dr["Bak15"]); }
            catch { }

            try { data.Bak14 = Convert.ToString(dr["Bak14"]); }
            catch { }

            try { data.Bak13 = Convert.ToString(dr["Bak13"]); }
            catch { }

            try { data.Bak12 = Convert.ToString(dr["Bak12"]); }
            catch { }

            try { data.Bak11 = Convert.ToString(dr["Bak11"]); }
            catch { }

            try { data.Bak10 = Convert.ToString(dr["Bak10"]); }
            catch { }

            try { data.Bak9 = Convert.ToString(dr["Bak9"]); }
            catch { }

            try { data.Bak8 = Convert.ToString(dr["Bak8"]); }
            catch { }

            try { data.Bak7 = Convert.ToString(dr["Bak7"]); }
            catch { }

            try { data.Bak6 = Convert.ToString(dr["Bak6"]); }
            catch { }

            try { data.Bak5 = Convert.ToString(dr["Bak5"]); }
            catch { }

            try { data.Bak4 = Convert.ToString(dr["Bak4"]); }
            catch { }

            try { data.Bak3 = Convert.ToString(dr["Bak3"]); }
            catch { }

            try { data.Bak2 = Convert.ToString(dr["Bak2"]); }
            catch { }

            try { data.Bak1 = Convert.ToString(dr["Bak1"]); }
            catch { }

            try { data.Bak29 = Convert.ToString(dr["Bak29"]); }
            catch { }

            try { data.Bak28 = Convert.ToString(dr["Bak28"]); }
            catch { }

            try { data.Bak27 = Convert.ToString(dr["Bak27"]); }
            catch { }

            try { data.Bak26 = Convert.ToString(dr["Bak26"]); }
            catch { }

            try { data.Bak25 = Convert.ToString(dr["Bak25"]); }
            catch { }

            try { data.Bak24 = Convert.ToString(dr["Bak24"]); }
            catch { }

            try { data.Bak23 = Convert.ToString(dr["Bak23"]); }
            catch { }

            try { data.Bak22 = Convert.ToString(dr["Bak22"]); }
            catch { }

            try { data.Bak21 = Convert.ToString(dr["Bak21"]); }
            catch { }

            try { data.Bak30 = Convert.ToString(dr["Bak30"]); }
            catch { }

            return data;
        }
        public static MedicalResultData Construct(DataRow dr)
        {
            MedicalResultData data = new MedicalResultData();

            try { data.ID = Convert.ToString(dr["ID"]); }
            catch { }

            try { data.TEID = Convert.ToString(dr["TEID"]); }
            catch { }

            try { data.TemporaryUserID = Convert.ToString(dr["TemporaryUserID"]); }
            catch { }

            try { data.fujianqingdan = Convert.ToInt32(dr["fujianqingdan"]); }
            catch { }

            try { data.Time = Convert.ToDateTime(dr["Time"]); }
            catch { }

            try { data.ShenGao = Convert.ToDouble(dr["ShenGao"]); }
            catch { }

            try { data.TiZhong = Convert.ToDouble(dr["TiZhong"]); }
            catch { }

            try { data.ErWen = Convert.ToDouble(dr["ErWen"]); }
            catch { }

            try { data.GaoYa = Convert.ToInt32(dr["GaoYa"]); }
            catch { }

            try { data.DiYa = Convert.ToInt32(dr["DiYa"]); }
            catch { }

            try { data.XinLv = Convert.ToInt32(dr["XinLv"]); }
            catch { }

            try { data.XindianDatas = Convert.ToString(dr["XindianDatas"]); }
            catch { }

            try { data.XinDianResult = Convert.ToInt32(dr["XinDianResult"]); }
            catch { }

            try { data.XinDianXinLv = Convert.ToInt32(dr["XinDianXinLv"]); }
            catch { }

            try { data.SpO2 = Convert.ToInt32(dr["SpO2"]); }
            catch { }

            try { data.PR = Convert.ToInt32(dr["PR"]); }
            catch { }

            try { data.PI = Convert.ToInt32(dr["PI"]); }
            catch { }

            try { data.XueTang1 = Convert.ToDouble(dr["XueTang1"]); }
            catch { }

            try { data.XueTang2 = Convert.ToDouble(dr["XueTang2"]); }
            catch { }

            try { data.NiaoSuan = Convert.ToDouble(dr["NiaoSuan"]); }
            catch { }

            try { data.DanGuChun = Convert.ToDouble(dr["DanGuChun"]); }
            catch { }

            try { data.ZhiFang = Convert.ToDouble(dr["ZhiFang"]); }
            catch { }

            try { data.BMI = Convert.ToDouble(dr["BMI"]); }
            catch { }

            try { data.XinChenDaiXie = Convert.ToInt32(dr["XinChenDaiXie"]); }
            catch { }

            try { data.TiZhi = Convert.ToInt32(dr["TiZhi"]); }
            catch { }

            try { data.TiXing = Convert.ToInt32(dr["TiXing"]); }
            catch { }

            try { data.YaoWei = Convert.ToDouble(dr["YaoWei"]); }
            catch { }

            try { data.TunWei = Convert.ToDouble(dr["TunWei"]); }
            catch { }

            try { data.Bak20 = Convert.ToString(dr["Bak20"]); }
            catch { }

            try { data.Bak19 = Convert.ToString(dr["Bak19"]); }
            catch { }

            try { data.Bak18 = Convert.ToString(dr["Bak18"]); }
            catch { }

            try { data.Bak17 = Convert.ToString(dr["Bak17"]); }
            catch { }

            try { data.Bak16 = Convert.ToString(dr["Bak16"]); }
            catch { }

            try { data.Bak15 = Convert.ToString(dr["Bak15"]); }
            catch { }

            try { data.Bak14 = Convert.ToString(dr["Bak14"]); }
            catch { }

            try { data.Bak13 = Convert.ToString(dr["Bak13"]); }
            catch { }

            try { data.Bak12 = Convert.ToString(dr["Bak12"]); }
            catch { }

            try { data.Bak11 = Convert.ToString(dr["Bak11"]); }
            catch { }

            try { data.Bak10 = Convert.ToString(dr["Bak10"]); }
            catch { }

            try { data.Bak9 = Convert.ToString(dr["Bak9"]); }
            catch { }

            try { data.Bak8 = Convert.ToString(dr["Bak8"]); }
            catch { }

            try { data.Bak7 = Convert.ToString(dr["Bak7"]); }
            catch { }

            try { data.Bak6 = Convert.ToString(dr["Bak6"]); }
            catch { }

            try { data.Bak5 = Convert.ToString(dr["Bak5"]); }
            catch { }

            try { data.Bak4 = Convert.ToString(dr["Bak4"]); }
            catch { }

            try { data.Bak3 = Convert.ToString(dr["Bak3"]); }
            catch { }

            try { data.Bak2 = Convert.ToString(dr["Bak2"]); }
            catch { }

            try { data.Bak1 = Convert.ToString(dr["Bak1"]); }
            catch { }

            try { data.Bak29 = Convert.ToString(dr["Bak29"]); }
            catch { }

            try { data.Bak28 = Convert.ToString(dr["Bak28"]); }
            catch { }

            try { data.Bak27 = Convert.ToString(dr["Bak27"]); }
            catch { }

            try { data.Bak26 = Convert.ToString(dr["Bak26"]); }
            catch { }

            try { data.Bak25 = Convert.ToString(dr["Bak25"]); }
            catch { }

            try { data.Bak24 = Convert.ToString(dr["Bak24"]); }
            catch { }

            try { data.Bak23 = Convert.ToString(dr["Bak23"]); }
            catch { }

            try { data.Bak22 = Convert.ToString(dr["Bak22"]); }
            catch { }

            try { data.Bak21 = Convert.ToString(dr["Bak21"]); }
            catch { }

            try { data.Bak30 = Convert.ToString(dr["Bak30"]); }
            catch { }

            return data;
        }
    }
    public class MedicalResultDataDBOption
    {
        public static int Insert(MedicalResultData d)
        {
            StringBuilder sql = new StringBuilder();
            sql.Append("insert into MedicalResult (");
            sql.Append("ID, ");
            sql.Append("TEID, ");
            sql.Append("TemporaryUserID, ");
            sql.Append("fujianqingdan, ");
            sql.Append("Time, ");
            sql.Append("ShenGao, ");
            sql.Append("TiZhong, ");
            sql.Append("ErWen, ");
            sql.Append("GaoYa, ");
            sql.Append("DiYa, ");
            sql.Append("XinLv, ");
            sql.Append("XindianDatas, ");
            sql.Append("XinDianResult, ");
            sql.Append("XinDianXinLv, ");
            sql.Append("SpO2, ");
            sql.Append("PR, ");
            sql.Append("PI, ");
            sql.Append("XueTang1, ");
            sql.Append("XueTang2, ");
            sql.Append("NiaoSuan, ");
            sql.Append("DanGuChun, ");
            sql.Append("ZhiFang, ");
            sql.Append("BMI, ");
            sql.Append("XinChenDaiXie, ");
            sql.Append("TiZhi, ");
            sql.Append("TiXing, ");
            sql.Append("YaoWei, ");
            sql.Append("TunWei, ");
            sql.Append("Bak20, ");
            sql.Append("Bak19, ");
            sql.Append("Bak18, ");
            sql.Append("Bak17, ");
            sql.Append("Bak16, ");
            sql.Append("Bak15, ");
            sql.Append("Bak14, ");
            sql.Append("Bak13, ");
            sql.Append("Bak12, ");
            sql.Append("Bak11, ");
            sql.Append("Bak10, ");
            sql.Append("Bak9, ");
            sql.Append("Bak8, ");
            sql.Append("Bak7, ");
            sql.Append("Bak6, ");
            sql.Append("Bak5, ");
            sql.Append("Bak4, ");
            sql.Append("Bak3, ");
            sql.Append("Bak2, ");
            sql.Append("Bak1, ");
            sql.Append("Bak29, ");
            sql.Append("Bak28, ");
            sql.Append("Bak27, ");
            sql.Append("Bak26, ");
            sql.Append("Bak25, ");
            sql.Append("Bak24, ");
            sql.Append("Bak23, ");
            sql.Append("Bak22, ");
            sql.Append("Bak21, ");
            sql.Append("Bak30");
            sql.Append(") values (");
            sql.Append("'");
            sql.Append(d.ID.ToString());
            sql.Append("'");
            sql.Append(", ");
            sql.Append("'");
            sql.Append(d.TEID.ToString());
            sql.Append("'");
            sql.Append(", ");
            sql.Append("'");
            sql.Append(d.TemporaryUserID.ToString());
            sql.Append("'");
            sql.Append(", ");
            sql.Append("");
            sql.Append(d.fujianqingdan.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("'");
            sql.Append(d.Time.ToString("yyyy-MM-dd HH:mm:ss"));
            sql.Append("'");
            sql.Append(", ");
            sql.Append("");
            sql.Append(d.ShenGao.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("");
            sql.Append(d.TiZhong.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("");
            sql.Append(d.ErWen.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("");
            sql.Append(d.GaoYa.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("");
            sql.Append(d.DiYa.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("");
            sql.Append(d.XinLv.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("'");
            sql.Append(d.XindianDatas.ToString());
            sql.Append("'");
            sql.Append(", ");
            sql.Append("");
            sql.Append(d.XinDianResult.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("");
            sql.Append(d.XinDianXinLv.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("");
            sql.Append(d.SpO2.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("");
            sql.Append(d.PR.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("");
            sql.Append(d.PI.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("");
            sql.Append(d.XueTang1.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("");
            sql.Append(d.XueTang2.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("");
            sql.Append(d.NiaoSuan.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("");
            sql.Append(d.DanGuChun.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("");
            sql.Append(d.ZhiFang.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("");
            sql.Append(d.BMI.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("");
            sql.Append(d.XinChenDaiXie.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("");
            sql.Append(d.TiZhi.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("");
            sql.Append(d.TiXing.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("");
            sql.Append(d.YaoWei.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("");
            sql.Append(d.TunWei.ToString());
            sql.Append("");
            sql.Append(", ");
            sql.Append("'");
            sql.Append(d.Bak20.ToString());
            sql.Append("'");
            sql.Append(", ");
            sql.Append("'");
            sql.Append(d.Bak19.ToString());
            sql.Append("'");
            sql.Append(", ");
            sql.Append("'");
            sql.Append(d.Bak18.ToString());
            sql.Append("'");
            sql.Append(", ");
            sql.Append("'");
            sql.Append(d.Bak17.ToString());
            sql.Append("'");
            sql.Append(", ");
            sql.Append("'");
            sql.Append(d.Bak16.ToString());
            sql.Append("'");
            sql.Append(", ");
            sql.Append("'");
            sql.Append(d.Bak15.ToString());
            sql.Append("'");
            sql.Append(", ");
            sql.Append("'");
            sql.Append(d.Bak14.ToString());
            sql.Append("'");
            sql.Append(", ");
            sql.Append("'");
            sql.Append(d.Bak13.ToString());
            sql.Append("'");
            sql.Append(", ");
            sql.Append("'");
            sql.Append(d.Bak12.ToString());
            sql.Append("'");
            sql.Append(", ");
            sql.Append("'");
            sql.Append(d.Bak11.ToString());
            sql.Append("'");
            sql.Append(", ");
            sql.Append("'");
            sql.Append(d.Bak10.ToString());
            sql.Append("'");
            sql.Append(", ");
            sql.Append("'");
            sql.Append(d.Bak9.ToString());
            sql.Append("'");
            sql.Append(", ");
            sql.Append("'");
            sql.Append(d.Bak8.ToString());
            sql.Append("'");
            sql.Append(", ");
            sql.Append("'");
            sql.Append(d.Bak7.ToString());
            sql.Append("'");
            sql.Append(", ");
            sql.Append("'");
            sql.Append(d.Bak6.ToString());
            sql.Append("'");
            sql.Append(", ");
            sql.Append("'");
            sql.Append(d.Bak5.ToString());
            sql.Append("'");
            sql.Append(", ");
            sql.Append("'");
            sql.Append(d.Bak4.ToString());
            sql.Append("'");
            sql.Append(", ");
            sql.Append("'");
            sql.Append(d.Bak3.ToString());
            sql.Append("'");
            sql.Append(", ");
            sql.Append("'");
            sql.Append(d.Bak2.ToString());
            sql.Append("'");
            sql.Append(", ");
            sql.Append("'");
            sql.Append(d.Bak1.ToString());
            sql.Append("'");
            sql.Append(", ");
            sql.Append("'");
            sql.Append(d.Bak29.ToString());
            sql.Append("'");
            sql.Append(", ");
            sql.Append("'");
            sql.Append(d.Bak28.ToString());
            sql.Append("'");
            sql.Append(", ");
            sql.Append("'");
            sql.Append(d.Bak27.ToString());
            sql.Append("'");
            sql.Append(", ");
            sql.Append("'");
            sql.Append(d.Bak26.ToString());
            sql.Append("'");
            sql.Append(", ");
            sql.Append("'");
            sql.Append(d.Bak25.ToString());
            sql.Append("'");
            sql.Append(", ");
            sql.Append("'");
            sql.Append(d.Bak24.ToString());
            sql.Append("'");
            sql.Append(", ");
            sql.Append("'");
            sql.Append(d.Bak23.ToString());
            sql.Append("'");
            sql.Append(", ");
            sql.Append("'");
            sql.Append(d.Bak22.ToString());
            sql.Append("'");
            sql.Append(", ");
            sql.Append("'");
            sql.Append(d.Bak21.ToString());
            sql.Append("'");
            sql.Append(", ");
            sql.Append("'");
            sql.Append(d.Bak30.ToString());
            sql.Append("'");
            sql.Append(")");
            return WFNetLib.ADO.SQLServerOP.NonQuerySQL(sql.ToString());
        }
        public static int Delete(MedicalResultData d)
        {
            StringBuilder sql = new StringBuilder();
            sql.Append("delete from MedicalResult ");
            sql.Append(" where ID=");
            sql.Append("'");
            sql.Append(d.ID.ToString());
            sql.Append("'");
            return WFNetLib.ADO.SQLServerOP.NonQuerySQL(sql.ToString());
        }
        public static DataTable DataTableSelect()
        {
            StringBuilder sql = new StringBuilder();
            sql.Append("select * from MedicalResult ");
            return WFNetLib.ADO.SQLServerOP.DataTableSQL(sql.ToString());
        }
        public static DataTable DataTableSelect(string type,MedicalResultData d)
        {
            StringBuilder sql = new StringBuilder();
            if(type=="0")
            {
                sql.Append("select * from MedicalResult where ID=");
                sql.Append("('");
                sql.Append(d.ID.ToString());
                sql.Append("') and (TemporaryUserID='') order by Time desc");
            }
            else
            {
                sql.Append("select * from MedicalResult where TemporaryUserID=");
                sql.Append("'");
                sql.Append(d.ID.ToString());
                sql.Append("' order by Time desc");
            }
            return WFNetLib.ADO.SQLServerOP.DataTableSQL(sql.ToString());
        }
        public static DataTable DataTableSelect(string type,string id,string d1,string d2)
        {
            //日期字段名 BETWEEN '20130101' AND '20130130'
            StringBuilder sql = new StringBuilder();
            if (type == "0")
            {
                sql.Append("select * from MedicalResult where (ID=");
                sql.Append("'");
                sql.Append(id);
                sql.Append("') and (TemporaryUserID='') and (Time BETWEEN '" + d1 + "' AND '" + d2 + "') order by Time desc");
            }
            else
            {
                sql.Append("select * from MedicalResult where (TemporaryUserID=");
                sql.Append("'");
                sql.Append(id);
                sql.Append("') and (Time BETWEEN '" + d1 + "' AND '" + d2 + "') order by Time desc");
            }
            return WFNetLib.ADO.SQLServerOP.DataTableSQL(sql.ToString());
        }
        public static MedicalResultData Get(String _id)
        {
            StringBuilder sql = new StringBuilder();
            sql.Append("select * from MedicalResult where ID=");
            sql.Append("'");
            sql.Append(_id.ToString());
            sql.Append("' order by Time desc");
            DataTable dt = WFNetLib.ADO.SQLServerOP.DataTableSQL(sql.ToString());
            if (dt.Rows.Count == 0)
                return null;
            else
                return MedicalResultDataFactory.Construct(dt.Rows[0]);
        }
        public static MedicalResultData Get(string type,string _id,string d1)
        {
            StringBuilder sql = new StringBuilder();
            if(type=="0")
            {
                sql.Append("select * from MedicalResult where ID=");
                sql.Append("'");
                sql.Append(_id.ToString());
                sql.Append("' and Time='" + d1 + "'");
            }
            else
            {
                sql.Append("select * from MedicalResult where TemporaryUserID=");
                sql.Append("'");
                sql.Append(_id.ToString());
                sql.Append("' and Time='" + d1 + "'");
            }
            DataTable dt = WFNetLib.ADO.SQLServerOP.DataTableSQL(sql.ToString());
            if (dt.Rows.Count == 0)
                return null;
            else
                return MedicalResultDataFactory.Construct(dt.Rows[0]);
        }
        public static DataSet DataSetSelect()
        {
            StringBuilder sql = new StringBuilder();
            sql.Append("select * from MedicalResult ");
            return WFNetLib.ADO.SQLServerOP.DataSetSQL(sql.ToString());
        }
        public static SqlDataReader ReaderSelect(MedicalResultData d)
        {
            StringBuilder sql = new StringBuilder();
            sql.Append("select * from MedicalResult ");
            return WFNetLib.ADO.SQLServerOP.ReaderExecuteSQL(sql.ToString());
        }
    }
}